﻿using System.Collections.Generic;
using System.Linq;
using MovieAPI.Models;
namespace MovieAPI.DAL
{
    public class HallDAL
    {

        /// <summary>
        /// 获取所有影厅
        /// </summary>
        /// <returns></returns>
        public static List<Hall> GetHall()
        {
            using (filmEntities db = new filmEntities())
            {
                return db.Hall.ToList();
            }

        }
        /// <summary>
        /// 通过影厅类型获取影厅
        /// </summary>
        /// <param name="HallType"></param>
        /// <returns></returns>
        public static List<Hall> GetHallsByType(string HallType)
        {
            using (filmEntities db = new filmEntities())
            {
                return db.Hall.Where(H => H.HallType == HallType).ToList();
            }

        }
        /// <summary>
        /// 通过影厅ID获取影厅
        /// </summary>
        /// <param name="HallID"></param>
        /// <returns></returns>
        public static Hall GetHallsBySch(int HallID)
        {
            using (filmEntities db = new filmEntities())
            {
                return db.Hall.Where(H => H.HallID == HallID).FirstOrDefault();
            }

        }

    }
}